using UnityEngine;
using System.Collections;

public class ExplosionBehaviour : MonoBehaviour
{
	//Animacao da explosao
	private ManagerAnimationUV animationUV;
	
	//Som que tocará quando explodir
	public AudioClip sound;
	//Tocador
	private AudioSource audioSource;
	
	void Start()
	{
		animationUV = GetComponentInChildren<ManagerAnimationUV>();
		
		if(sound)
		{
			audioSource = GameObject.Find("_AudioSourceEffects").GetComponent<AudioSource>();
			
			audioSource.PlayOneShot(sound);
		}
	}
	
	void Update()
	{
		if(animationUV.CanChangeAnimation)
		{
			Destroy(gameObject);
		}
	}
}
